<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:t="http://myfaces.apache.org/tomahawk"
				template="/pages/template.xhtml">
	
	<ui:param name="pageTitle" value="#{crudBean.fullTitle}" />
	
	<ui:define name="saveStateObjects">
		<t:saveState value="#{crudBean.searchObject}" />
		<t:saveState value="#{crudBean.currentState}" />
		<t:saveState value="#{crudBean.entity}" />
		<t:saveState value="#{crudBean.searchResult}" />
	</ui:define>
				
	<ui:define name="buttonItens">
	
		<!-- Painel dos botoes de pesquisa -->
		<h:panelGroup rendered="#{crudBean.searching}">
			<a4j:commandButton value="Pesquisar" actionListener="#{crudBean.pesquisar}" reRender="tblData"/>
			<h:outputText value=" "/>
			<a4j:commandButton value="Novo" actionListener="#{crudBean.preparaInserir}" reRender="formulario, panelTitle" />
			<h:panelGroup rendered="#{crudBean.reporting}">
				<h:outputText value=" "/>
				<a4j:commandButton  value="Relatório" actionListener="#{crudBean.report}"/>
			</h:panelGroup>
		</h:panelGroup>
		
		<!-- Painel dos botoes de edicao -->
		<h:panelGroup rendered="#{crudBean.updating || crudBean.viewing}">
			<a4j:commandButton value="Gravar" actionListener="#{crudBean.inserir}" rendered="#{crudBean.inserting}" reRender="formulario, panelTitle"/>
			<a4j:commandButton  value="Alterar" actionListener="#{crudBean.alterar}" rendered="#{crudBean.editing}" reRender="formulario, panelTitle"/>
			<h:outputText value=" "/>
			<a4j:commandButton  value="Voltar" actionListener="#{crudBean.cancelar}" reRender="formulario, panelTitle" />
		</h:panelGroup>
		
	</ui:define>
	
</ui:composition>